package com.inray.nbs.utils;




public class MathUitl {
	public static Integer checkInt(String str) {
		Integer i = null;
		boolean b = MathUitl.mathStringCheck(str);
		if (b) {
			i = Integer.parseInt(str);
		} else {
			i = null;
		}
		return i;
	}

	public static Float checkFloat(String str) {
		Float f = null;
		boolean b = str.matches("^((0)|([1-9][0-9]*))\\.[0-9]+$");
		if (b || MathUitl.mathStringCheck(str)) {
			f = Float.parseFloat(str);
		} else {
			f = null;
		}
		return f;
	}

	public static boolean mathStringCheck(String str) {
		if (str == null || "".equals(str) || !(str.matches("[0-9]+"))) {
			return false;
		} else {
			return true;
		}

	}

}
